package Gui;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JList;
import javax.swing.AbstractListModel;
import javax.swing.table.JTableHeader;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import java.awt.Button;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JLayeredPane;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;




public class DefinisionOfCourse extends JPanel
{
	public Secretry main_frame;
	
	private final ButtonGroup buttonGroup = new ButtonGroup();
	public JPanel Open_new_course;
	int selection=0;
	public JPanel tal;
	public DefinisionOfCourse(Secretry a)
	{
		setLayout(null);
		main_frame=a;
		tal=this;
		JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("Update course");
		rdbtnNewRadioButton_1.setBounds(23, 141, 207, 23);
		add(rdbtnNewRadioButton_1);
		rdbtnNewRadioButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				selection=2;
			}
		});
		buttonGroup.add(rdbtnNewRadioButton_1);
		
		JRadioButton rdbtnNewRadioButton_2 = new JRadioButton("Remove course");
		rdbtnNewRadioButton_2.setBounds(23, 64, 207, 23);
		add(rdbtnNewRadioButton_2);
		rdbtnNewRadioButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				selection=1;
			}
		});
		buttonGroup.add(rdbtnNewRadioButton_2);
		
		JLabel lblDefinisionOfCourse = new JLabel("Definition of course");
		lblDefinisionOfCourse.setBounds(142, 11, 145, 23);
		add(lblDefinisionOfCourse);
		lblDefinisionOfCourse.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton Next1Window = new JButton("Next");
		Next1Window.setBounds(333, 244, 89, 23);
		add(Next1Window);
		
		
		Next1Window.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e) 
			{
				
				if(selection==0){
						
					showMsg("You need to enter your choice. Pleas try again");
				}
				if(selection==1){

					main_frame.update_panel(2, 3);
					
				}
				if(selection==2){

					main_frame.update_panel(2, 4);
					
				}
				if(selection==3){

				main_frame.update_panel(2, 5);
					
				}
			}
		});
		
		JButton Back1Window = new JButton("Back");
		Back1Window.setBounds(234, 244, 89, 23);
		add(Back1Window);

		JRadioButton rdbtnNewRadioButton = new JRadioButton("Open new course");
		rdbtnNewRadioButton.setBounds(23, 101, 207, 23);
		add(rdbtnNewRadioButton);
		rdbtnNewRadioButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				selection=3;
			}
		});
		buttonGroup.add(rdbtnNewRadioButton);
		
		
		Back1Window.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e) 
			{
					
				main_frame.update_panel(2,1);
		
				
			}
		});


	}
	
	
	public void Open_new_course()
	{
		Open_new_course=new JPanel();
		JButton a=new JButton("test");
		Open_new_course.add(a);
	}
	public void showMsg(String msg)
	{
		JOptionPane.showMessageDialog(null,msg,"Login Eror",JOptionPane.ERROR_MESSAGE);
	}
}
